package com.spj.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author :spj
 * @Date:2022/3/31
 * @description:
 */
@Aspect
@Component
public class MyAop {
    @Pointcut("execution(* com.spj..*.*(..))")
    public void myCut() {
    }
    @Before("myCut()")
    public void myBefore(JoinPoint joinPoint){
        System.out.println("前置通知：日志打印开始……");
        System.out.println("对应目标类是："+joinPoint.getTarget());
        System.out.println("对应目标类的方法是："+joinPoint.getSignature().getName());
    }
}
